package cn.bitkit.mybatis.builder;

import java.util.Map;
import java.util.StringJoiner;

import cn.bitkit.mybatis.CriteriaHandler;
import cn.bitkit.mybatis.base.BaseSqlBuilder;
import cn.bitkit.mybatis.entity.EntityClass;

public class DeleteByIdListBuilder implements BaseSqlBuilder {

	@Override
	public String build(EntityClass entityClass, Map<String, Object> paramMap) {
		StringJoiner sql = new StringJoiner(" \n");
		sql.add("DELETE FROM " + entityClass.getTableName());
		sql.add("WHERE " + entityClass.getId().getColumn()+" IN");
		sql.add("(" + CriteriaHandler.initList(paramMap) + ")");
        return sql.toString();
	}

}
